package com.hongtech.modules.knowledge.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hongtech.common.service.impl.CrudServiceImpl;
import com.hongtech.common.util.BeanCopierUtils;
import com.hongtech.modules.knowledge.mapper.BodyPartMapper;
import com.hongtech.modules.knowledge.dto.BodyPartDTO;
import com.hongtech.modules.knowledge.entity.BodyPartEntity;
import com.hongtech.modules.knowledge.service.BodyPartService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 身体部位表
 *
 * @author admin 123456789@qq.com
 * @since 1.0.0 2023-09-01
 */
@Service
public class BodyPartServiceImpl extends CrudServiceImpl<BodyPartMapper, BodyPartEntity, BodyPartDTO> implements BodyPartService {

    @Override
    public List<BodyPartDTO> listBodyPart() {
        LambdaQueryWrapper<BodyPartEntity> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.orderByAsc(BodyPartEntity::getOrderNumber);
        List<BodyPartEntity> list = baseDao.selectList(queryWrapper);
        return BeanCopierUtils.copyPropertiesList(list, BodyPartDTO.class);
    }

}
